// 文章接口数据
import request from '@/uitls/request'

// 获取频道的文章列表
export const getArticles = params => {
  return request({
    method: 'GET',
    url: '/v1_0/articles',
    params
  })
}

// 获取频道的详情列表
// export const getArticlesDetails = articleId => {
//   return request({
//     method: 'GET',
//     url: `/v1_0/articles/${articleId}`
//   })
// }
export const getChannelsDetails = articleId => {
  return request({
    url: `/v1_0/articles/${articleId}`,
    method: 'get'
  })
}

// 收藏文章  /v1_0/article/collections
export const getCollections = target => {
  return request({
    method: 'POST',
    url: '/v1_0/article/collections',
    data: {
      target
    }
  })
}

// 取消收藏文章  /v1_0/article/collections/:target
export const delCollections = target => {
  return request({
    method: 'DELETE',
    url: `/v1_0/article/collections/${target}`
  })
}

// 对文章进行点赞  /v1_0/article/likings
export const getLiking = target => {
  return request({
    url: '/v1_0/article/likings',
    method: 'POST',
    data: {
      target
    }
  })
}

// 对文章取消点赞 /v1_0/article/likings/:target
export const delLiking = target => {
  return request({
    url: `/v1_0/article/likings/${target}`,
    method: 'DELETE'
  })
}

// 获取文章列表评论信息  /v1_0/comments
export const getCommont = params => {
  return request({
    url: '/v1_0/comments',
    method: 'GET',
    params
  })
}
